%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[11pt]{article}
\input{common}
\setCJKmainfont[Extension = .otf, BoldFont = FandolSong-Bold, ItalicFont = FandolKai-Regular, FallBack = {SimSun}]{FandolSong-Regular}
\setCJKsansfont[Extension = .otf, BoldFont = FandolHei-Bold]{FandolHei-Regular}
\newCJKfontfamily\FangSong[Extension = .otf]{FandolFang-Regular}
\xeCJKsetup{AutoFallBack = true}
\xeCJKsetup{CJKglue = {\hskip 0pt plus 0.04em minus 0.01em}}

\usepackage{longtable}
\usepackage[table]{xcolor}

\definecolor{MyTheme}{RGB}{33, 138, 33}
\colorlet{MyRule1}{MyTheme!70}
\colorlet{MyRule2}{MyTheme!40}
\colorlet{MyFrame}{MyTheme!30}
\colorlet{MyPinYin}{MyTheme}
\colorlet{MyCellBackground2}{white!98!MyTheme}
\colorlet{MyTagBackground}{white!90!MyTheme}
\colorlet{MySource}{black!50}
\newcommand\PinYin[1]{\textcolor{MyPinYin}{\textsf{#1}}}
\setlength\fboxsep{1pt}
\newcommand\MyTag[1]{\fcolorbox{MyFrame}{MyTagBackground}{{\FangSong\footnotesize#1}}}
\newcommand\TabRight{\hfill\nobreak\null\penalty-1\null\hfill}

\setlength\tabcolsep{3pt}
\renewcommand\arraystretch{1.2}
\setlength\LTpre{0pt}

\setlength\LTpost{0pt}
\newdimen\解释列宽
\解释列宽=3cm
\newdimen\例句列宽
\例句列宽=\textwidth
\advance\例句列宽 by -\解释列宽
\advance\例句列宽 by -2\tabcolsep
\advance\例句列宽 by -3\arrayrulewidth
\newdimen\例句内部宽度
\例句内部宽度=\例句列宽
\advance\例句内部宽度 by -2\tabcolsep
\newcommand\IfNotEmpty[2]{\def\测试用{#1}\ifx\测试用\empty\else#2\fi}
\def\五角星{☆}
\newcommand\IfNotEmptyOrStar[2]{\IfNotEmpty{#1}{\ifx\测试用\五角星\else#2\fi}}

\newcommand\TiaoMu[1]{\newpage#1}
\newcommand\Zi[2]{%
	\noindent\hbox to \textwidth{%
		\hfill{\LARGE\textbf{#1}}\quad%
		{\normalsize\PinYin{#2}}\hfill%
	}%
	\medskip
}
\newcommand\YiXiangBiao[1]{%
	\arrayrulecolor{MyRule1}%
	\begin{longtable}{%
		|p{\解释列宽}%
		|@{}p{\例句列宽}@{}|%
	}\hline#1\end{longtable}%
}
\newcount\当前例句号
\newcount\总例句数
\newcommand\YiXiang[6]{%
	\IfNotEmpty{#2}{\leftskip 7pt \cellcolor{MyCellBackground2}}%
	\IfNotEmpty{#1}{{\small\PinYin{#1}}\space}%
	\IfNotEmptyOrStar{#2}{\MyTag{#2}\hskip 2pt plus 0.5pt minus 0.5pt}%
	#3%
	& \begin{tabular}[t]{p{\例句内部宽度}}%
		\arrayrulecolor{MyRule2}%
		\IfNotEmpty{#4}{#4\\\hline}%
		\global\当前例句号=0%
		\global\总例句数=#5%
		#6%
	\end{tabular}\\
	\hline
}
\newcommand\JinYou[1]{“#1”}
\newcommand\JinYouSeparator{、}
\newcommand\LiJu[3]{%
	\global\advance\当前例句号 by 1%
	#1\TabRight{\color{MySource}\scriptsize\kern-0.5em（{\footnotesize#3}）\kern-0.5em}\par\textit{{\small#2}}\\%
	\ifnum\当前例句号<\总例句数\hline\fi%
}

\begin{document}
	\input{dictionary-output}
\end{document}
